package com.wlw.service;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wlw.entity.TravalNote;
import com.wlw.entity.User;

import edu.xjsoft.base.service.DefaultEntityManager;

@Service
@Transactional
public class TravalNoteService extends DefaultEntityManager<TravalNote> {
	
	public List<TravalNote> getUserTravalNotes(HttpServletRequest req){
		String hql = "select t from TravalNote t where t.user.uname = ?";
		User user = (User)req.getSession().getAttribute("user");
		if (user!=null) {
			String uname = user.getUname();
			List<TravalNote> travalNotes = getEntityDao().find(hql, uname);
			return travalNotes;
		}else {
			return null;
		}
	}
}
